<div class="orderInfo" style="    overflow: auto;">
    <div class="panel">
        <div class="cnt">
            <div style="width: 20%;float: left;" class="blackColor"> 自取：</div>
            <div style="width: 80%;float: left;">
                <p><span>A栋B1餐厅</span>&nbsp;&nbsp;<span>010-66579932</span></p>
                <%--<p><span>大厦六层</span></p>--%>
            </div>
        </div>
    </div>
    <%--<div class="panel" id="delivery-Time">--%>
        <%--<div class="cnt" style="min-height: 30px;line-height: 30px;">--%>
            <%--<div style="width: 30%;float: left" class="blackColor"> 预约取餐时间：</div>--%>
            <%--<div style="width:65%;float: left">--%>
                <%--<p id="deliveryTime">19:00-21:00</p>--%>
                <%--<select class="select" id="deliveryTimes" data-default="1">--%>
                    <%--<option value="09:00-12:00">09:00-12:00</option>--%>
                    <%--<option value="14:00-18:00">14:00-18:00</option>--%>
                    <%--<option value="19:00-21:00">19:00-21:00</option>--%>
                <%--</select>--%>
            <%--</div>--%>
            <%--&lt;%&ndash;<div style="width: 30%;min-width: 50px;float: left">8:00-20:00</div>&ndash;%&gt;--%>
        <%--</div>--%>
    <%--</div>--%>
    <div class="panel" id="pay-way">
        <div class="cnt">
            <div class="blackColor">支付方式：</div>
            <div style="width: auto">
                <div style="clear: both"></div>
                <i class="i-pay-way i-select">
                    <img src="/statics/imgs/daofu_l.png">
                    <p data-method="SKY">现场支付</p>
                </i>
                <%--<i class="i-pay-way" id="weixinPay" style="display: none;">--%>
                    <%--<img src="/statics/imgs/wechat.png">--%>
                    <%--<p data-method="WEIXIN">微信支付</p>--%>
                <%--</i>--%>
            </div>
        </div>
    </div>
    <div class="panel">
        <div class="cnt">
            <div class="blackColor"> 商品清单：
            </div>
            <div class="order-goods-list">
                <ul id="orderMenus">
                    <script type="text/x-dot-template" id="menuList">
                        {{~it.menus:value:index}}
                        <li>
                            <div class="g-tit">{{=value.itemName}}</div>
                            <div class="g-pri">￥{{=value.amount}}</div>
                            <div class="g-pri">×{{=value.num}}</div>
                        </li>
                        {{~}}
                        <li>
                            <div class="g-pri" style="    width: 100%;">应付：<span
                                    style="color: red">￥{{=it.amount}}</span></div>
                        </li>
                    </script>
                </ul>
            </div>
        </div>
    </div>
    <div class="panel">
        <div class="cnt">
            <div class="blackColor"> 备注：<input type="text" id="remark" size="50" maxlength='50'
                                               placeholder="备注信息不能超过50字"/></div>
        </div>
    </div>
</div>


<div class="ypfood-head">
    <div class="back-div" onClick="javascript :history.back(-1);">
        <img src="/statics/imgs/head-back.png?v=${params.ver}">
    </div>
    <div onclick="subOrder()">
        <span class="title-span">提交订单</span>
    </div>
</div>
<div class="footer">
    <div style="width:auto;">待支付：</div>
    <div class="monye">￥<span id="money"></span></div>
    <div class="subOrder" onclick="subOrder()">
        <span class="title-span">提交订单</span>
    </div>
</div>
<script>
    is_weixin();
    //初始化支付方式
    function is_weixin() {
        var ua = navigator.userAgent.toLowerCase();
        if (ua.match(/MicroMessenger/i) == "micromessenger") {
            $("#weixinPay").css("display","");
            return true;
        } else {
            $("#weixinPay").css("display","none");
            return false;
        }
    }
    json("/order/orderMenus.jspa", {}, function (data) {
        $("#money").html(data.amount);
        $("#orderMenus").html(doT.template($("#menuList").html())(data));
        $("#pay-way i").bind("click", function () {
            $("#pay-way").removeClass("param-pop");
            $("#pay-way i").removeClass("i-select");
            $("#pay-way i p").css("color", "#d0d0d0");
            $($("#pay-way i img")[0]).attr("src", "/statics/imgs/daofu.png?v=${params.ver}");
            $($("#pay-way i img")[1]).attr("src", "/statics/imgs/wechat.png?v=${params.ver}");

            $(this).addClass("i-select");
            $(this).find("p").css("color", "#ffc786");
            if ($(this).find("p").html() == "现场支付") {
                $(this).find("img").attr("src", "/statics/imgs/daofu_l.png?v=${params.ver}");
            } else if ($(this).find("p").html() == "微信支付") {
                $(this).find("img").attr("src", "/statics/imgs/wechat_l.png?v=${params.ver}");
            }
        });
    });
    function subOrder(){
        var memo = $("#remark").val() == "备注信息不能超过50字" ? "" : $("#remark").val();
        var payMethod = $("#pay-way i.i-select p").attr("data-method");
        var params = {
             memo: memo
            , payMethod: payMethod
        };

        json("/order/submitOrder.jspa", params, function (data) {
                if (data.code == 0) {
                    layer.open({content: "订单提交成功", time: 3});
                    setTimeout(function(){
                        if (data.payMethod == 'SKY') {
                            window.location.href = "/order/subOk.jspa?orderSn=" + data.orderSn;
                        } else if (data.payMethod == "WEIXIN") {
                            window.location.href = "/weixin/weixinPay.jspx?sn=" + data.orderSn;
                        }
                    },3000);
                } else {
                    layer.open({content: data.description, time: 3})
                }
        });
    }
</script>